home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / AIncludes / FixMath.a < prev    next >
Encoding:
Text File  |  1992-08-28  |  3.0 KB  |  91 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        FixMath.a
  3. ;
  4. ;    Contains:    xxx put contents here xxx
  5. ;
  6. ;    Written by:    xxx put writers here xxx
  7. ;
  8. ;    Copyright:    © 1991-1992 by Apple Computer, Inc., all rights reserved.
  9.  
  10. ;*** Warning: This is an alpha version of the Interfaces for Cube-E. 
  11. ;***          Things may change.  Caveat Programmer.
  12.  
  13.  
  14.  
  15.  
  16.     IF &TYPE('__INCLUDINGFIXMATH__') = 'UNDEFINED' THEN
  17. __INCLUDINGFIXMATH__    SET    1
  18.  
  19. ; These calls support three types of fixed point numbers, each 32 bits long.
  20. ; The bits are interpreted as shown. The '-' represents the sign bit.
  21. ;
  22. ; Type <---------Integer Portion--------> <-------Fractional Portion------>
  23. ;LongInt -xxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx.
  24. ;Fixed -xxxxxxx xxxxxxxx.xxxxxxxx xxxxxxxx
  25. ;Fract -x.xxxxxxxx xxxxxxxx xxxxxxxx xxxxxx
  26. ;
  27. ; Type LongInt can represent integers between +/-2147483647. Type Fixed can
  28. ; represent fractional quantities between +/-32768, with about 5 digits of
  29. ; accuracy. Type Fract can represent fractional quantities between +/-2 with
  30. ; about 9 digits of accuracy. These numeric representations are useful for
  31. ; applications that do not require the accuracy of the floating point routines,
  32. ; and which need to run as fast as possible. The Graf3D three dimensional
  33. ; graphics package resides on top of these routines. Although FixMul is in the
  34. ; file ToolTraps, it is shown below to show how it handles different types.
  35. ; Additional fixed point routines are described in the Inside Macintosh chapter,
  36. ; “Toolbox Utilities.”
  37.  
  38. ; FUNCTION FixMul(x, y: Fixed): Fixed;
  39. ; FixMul returns x * y. Note that FixMul effects "type * Fixed --> type":
  40. ; Fixed * Fixed --> Fixed
  41. ; LONGINT * Fixed --> LONGINT
  42. ; Fixed * LONGINT --> LONGINT
  43. ; Fract * Fixed --> Fract
  44. ; Fixed * Fract --> Fract
  45.  
  46. ; FUNCTION FracMul(x, y: Fract): Fract;
  47. ; FracMul returns x * y. Note that FracMul effects "type * Fract --> type":
  48. ; Fract * Fract --> Fract
  49. ; LONGINT * Fract --> LONGINT
  50. ; Fract * LONGINT --> LONGINT
  51. ; Fixed * Fract --> Fixed
  52. ; Fract * Fixed --> Fixed
  53.  
  54. ; FUNCTION FixDiv(x, y: Fixed): Fixed;
  55. ; FixDiv returns x / y. Note that FixDiv effects "type / type --> Fixed":
  56. ; Fixed / Fixed --> Fixed
  57. ; LONGINT / LONGINT --> Fixed
  58. ; Fract / Fract --> Fixed
  59. ; LONGINT / Fixed --> LONGINT
  60. ; Fract / Fixed --> Fract
  61.  
  62. ; FUNCTION FracDiv(x, y: Fract): Fract;
  63. ; FracDiv returns x / y. Note that FracDiv effects "type / type --> Fract":
  64. ; Fract / Fract --> Fract
  65. ; LONGINT / LONGINT --> Fract
  66. ; Fixed / Fixed --> Fract
  67. ; LONGINT / Fract --> LONGINT
  68. ; Fixed / Fract --> Fixed
  69.  
  70. ; FUNCTION FracSqrt(x: Fract): Fract;
  71. ; FracSqrt returns the square root of x. Both argument and result are regarded
  72. ; as unsigned.
  73.  
  74. ; FUNCTION FracCos(x: Fixed): Fract;
  75. ; FUNCTION FracSin(x: Fixed): Fract;
  76. ; FracCos and FracSin return the cosine and sine, respectively, given the
  77. ; argument x in radians.
  78.  
  79. ;The following routines are accessed via the glue code
  80. ;which will call the trap on a 128K ROM machine
  81.  
  82.  
  83. _FracCos          OPWORD      $A847
  84. _FracSin          OPWORD      $A848
  85. _FracSqrt         OPWORD      $A849
  86. _FracMul          OPWORD      $A84A
  87. _FracDiv          OPWORD      $A84B
  88. _FixDiv           OPWORD      $A84D
  89.  
  90.     ENDIF    ; ...already included
  91.